package indvi.cfeng.persistencedemo.entity;

import lombok.Data;
import lombok.experimental.Accessors;
import org.springframework.data.redis.core.RedisHash;
import org.springframework.data.redis.core.index.Indexed;

/**
 * @author Cfeng
 * @date 2022/7/18
 * Redis是集群部署，实体hash对象需要进行网络传输，需要序列化，序列化的方式一般为jdk或者json
 */

@Data
@Accessors(chain = true)
@RedisHash(value = "Student",timeToLive = 10) //设置存活时间10s
public class RedisStudent  {
    //性别枚举
    public enum Gender {
        MALE,FEMALE
    }

    private String id;
    @Indexed //redis中的
    private String name;
    //性别
    private Gender gender;
    private  int grade;
}
